package com.forum.mapper;

import com.forum.entity.Categories;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CategoriesMapper {

    @Select("select * from categories")
    List<Categories> queryCategories();

    @Insert("insert into categories(name,description,sort)" +
            "values " +
            "(#{name},#{description},#{sort})")
    void insert(Categories category);

    void update(Categories category);

    @Delete("delete from categories where id = #{id}")
    void deleteById(Long id);

    @Select("select * from categories where name = #{name}")
    Categories queryByName(String name);
}
